package com.ruoyi.web.pojo.dto.stock;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.web.domain.stock.Stock;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * @description 库存表
 * @author zhengkai.blog.csdn.net
 * @date 2024-01-06
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("库存表")
public class StockRep extends BaseEntity {


    /**
     * id
     */

    @ApiModelProperty("id")
    private String id;

    /**
     * 入库日期
     */
    @ApiModelProperty("入库日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date storageDate;

    /**
     * 产品名称
     */
    @ApiModelProperty("产品名称")
    private String product;

    /**
     * 产品类型
     */
    @ApiModelProperty("产品类型(农资 ; 农产品 ; 机械设备 ; 其他类)")
    private String type;

    /**
     * 来源
     */
    @ApiModelProperty("来源（线上采购 ; 线下采购; 其他")
    private String source;

    /**
     * 数量
     */
    @ApiModelProperty("数量")
    private Float number;

    /**
     * 单位
     */
    @ApiModelProperty("单位")
    private String unit;



    /**
     * 删除标志（0代表存在 2代表删除）
     */
    @ApiModelProperty("删除标志（0代表存在 2代表删除）")
    private String delFlag;

    /**
     * 用户id
     */
    @ApiModelProperty("用户id")
    private String userId;

    @ApiModelProperty("开始时间 yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date startTime;
    @ApiModelProperty("结束时间 yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date endTime;
    @ApiModelProperty(value = "附件")
    private String pic;

    public StockRep() {}


    public StockRep (StockVo stock) {
        this.id = String.valueOf(stock.getId());
        this.storageDate = stock.getStorageDate();
        this.product = stock.getProduct();
        this.type = stock.getType();
        this.source = stock.getSource();
        this.number = stock.getNumber();
        this.unit = stock.getUnit();
        this.delFlag = stock.getDelFlag();
        this.userId = String.valueOf(stock.getUserId());
        this.setPic(stock.getPic());
        this.setRemark(stock.getRemark());
        this.setCreateBy(stock.getCreateBy());
    }

    public StockRep (Stock stock) {
        this.id = String.valueOf(stock.getId());
        this.storageDate = stock.getStorageDate();
        this.product = stock.getProduct();
        this.type = stock.getType();
        this.source = stock.getSource();
        this.number = stock.getNumber();
        this.unit = stock.getUnit();
        this.delFlag = stock.getDelFlag();
        this.userId = String.valueOf(stock.getUserId());
        this.setPic(stock.getPic());
        this.setRemark(stock.getRemark());
    }
}
